<template>
  <div class="iframe">
    <iframe :src="url" frameborder="0" v-if="url" />
  </div>
</template>

<script setup lang="ts">
import { ref } from "vue";
import WebContainerAPI from "../../class/WebContainerAPI";
const url = ref("");

WebContainerAPI.on("server-ready", (payload: { url: string }) => {
  if (payload.url) url.value = payload.url;
});
</script>

<style lang="less" scoped>
.iframe {
  flex: auto;
  position: relative;
  border-left: solid var(--t-main-border-color) 1px;
  background-color: var(--t-main-background-color);
}

iframe {
  background-color: #fff;
  height: 100%;
  width: 100%;
}
</style>
